package com.kunzai.config;

import com.kunzai.handerone.HelloIntercepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class ConfigOne extends WebMvcConfigurationSupport {

    @Autowired
    private HelloIntercepter helloIntercepter;


    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        //上面配置页面拦截器
    }


    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        InterceptorRegistration helloInterCept = registry.addInterceptor(new HelloIntercepter());
        //配置拦截路径
        helloInterCept.addPathPatterns("/**");
        //配置不拦截路径
        helloInterCept.excludePathPatterns("/DishRun/Dishdetails");
    }
}
